package com.ruoyi.controller;


import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.service.IDataStatisticsService;
import com.ruoyi.vo.DataGrowthVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Description:数据统计
 * @Param:
 * @Return:
 */
@RestController
@RequestMapping("data")
public class DataStatisticsController extends BaseController {

    @Autowired
    private IDataStatisticsService dataStatisticsService;


    /**
     * @Description:获取某月的新增数据
     * @Param:
     * @Return:
     */
    @RequestMapping("getDataGrowth")
    public TableDataInfo getDataGrowth(DataGrowthVo vo){
        return getDataTable(dataStatisticsService.getDataGrowth(vo.getYear(), vo.getMonth(), vo.getTable()));
    }


    /**
     * @Description:获取某月的平台盈利
     * @Param:
     * @Return:
     */
    @RequestMapping("getMonthlyProfit")
    public TableDataInfo getMonthlyProfit(DataGrowthVo vo){
        return getDataTable(dataStatisticsService.getMonthlyProfit(vo.getYear(), vo.getMonth()));
    }


    /**
     * @Description:获取某年的平台盈利
     * @Param:
     * @Return:
     */
    @RequestMapping("getAnnualProfit")
    public TableDataInfo getAnnualProfit(DataGrowthVo vo){
        return getDataTable(dataStatisticsService.getAnnualProfit(vo.getYear()));
    }



    /**
     * @Description:获取某周的订单量
     * @Param:
     * @Return:
     */
    @RequestMapping("getWeeklyOrder")
    public TableDataInfo getWeeklyOrder(DataGrowthVo vo){

        return getDataTable(dataStatisticsService.getWeeklyOrder(vo.getStartOfWeek(),vo.getEndOfWeek()));
    }

    /**
     * @Description:获取某月的订单量
     * @Param:
     * @Return:
     */
    @RequestMapping("getMonthlyOrder")
    public TableDataInfo getMonthlyOrder(DataGrowthVo vo){

        return getDataTable(dataStatisticsService.getMonthlyOrder(vo.getYear(), vo.getMonth()));
    }


    /**
     * @Description:获取某月的订单量
     * @Param:
     * @Return:
     */
    @RequestMapping("getAnnualOrder")
    public TableDataInfo getAnnualOrder(DataGrowthVo vo){

        return getDataTable(dataStatisticsService.getAnnualOrder(vo.getYear()));
    }





}
